package ua.edu.onu.myDatePicker;


import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;

public class dateActions{
    public Date startDate = new Date(20141214);
    public Date endDate = new Date(20171215);
    public Date userDate;

    static void getTomorrow(Calendar dateToTommorow)
    {
        Calendar myCal =Calendar.getInstance();
        myCal = dateToTommorow;
        myCal.add(Calendar.MONTH,-1);
        myCal.add(Calendar.DATE, 1);
        System.out.println("Tommorow date = "+myCal.getTime());
    }

    static void getYesterday(Calendar dateToYesterday)
    {
        Calendar myCal =Calendar.getInstance();
        myCal = dateToYesterday;
        myCal.add(Calendar.MONTH,-1);
        myCal.add(Calendar.DATE, -1);
        System.out.println("Yesterday's date = "+myCal.getTime());
    }


    static void CheckDate(Date testDate, Date startDate, Date endDate) {
        if(!(testDate.before(startDate) || testDate.after(endDate)))
        {
            System.out.println("Your date is in range between "+startDate+" and "+endDate );
        }
    }
    static void EqualDate(Date date1, Date date2)
    {
        if(date1.equals(date2))
        {
            System.out.println("They are equal");
        }
        else
        {
            System.out.println("They are not equal");
        }
    }


    public static void main(String[] args) {
        System.out.println();
        Calendar a = new GregorianCalendar(2014,12,1);

        getYesterday(a);
    }


}


